package com.tj.collection.controller.admin.request;


import com.fqgj.common.api.ParamsObject;
import com.fqgj.common.utils.CollectionUtils;
import com.fqgj.exception.common.ApiIllegalArgumentException;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2016/11/18
 * Time: 下午5:50
 */
public class AddRoleMenuVo extends ParamsObject {
    private Long roleId;
    private List<Long> menuIds;

    public Long getRoleId() {
        return roleId;
    }

    public AddRoleMenuVo setRoleId(Long roleId) {
        this.roleId = roleId;
        return this;
    }

    public List<Long> getMenuIds() {
        return menuIds;
    }

    public AddRoleMenuVo setMenuIds(List<Long> menuIds) {
        this.menuIds = menuIds;
        return this;
    }

    @Override
    public void validate() {
        if (roleId == null || CollectionUtils.isEmpty(menuIds)) {
            throw new ApiIllegalArgumentException("角色和菜单项不能为空");
        }
    }
}
